package com.example.image;


public class ImageOptions {
    /**
     * 占位图
     */
    private int mPlaceImage;

    /**
     * 错误图
     */
    private int mErrorImage;

    /**
     * 是否支持Gif图
     */
    private boolean mIsGif;

    /**
     * 是否圆形图
     */
    private boolean mIsCircle;

    /**
     * 是否支持内存缓存
     */
    private boolean mIsMemoryCache;

    /**
     * 是否支持磁盘缓存
     */
    private boolean mIsDiskCache;

    public int getPlaceImage() {
        return mPlaceImage;
    }

    public int getErrorImage() {
        return mErrorImage;
    }

    public boolean isIsGif() {
        return mIsGif;
    }

    public boolean isCircle() {
        return mIsCircle;
    }

    public boolean isMemoryCache() {
        return mIsMemoryCache;
    }

    public boolean isDiskCache() {
        return mIsDiskCache;
    }

    private ImageOptions(int placeImage, int errorImage, boolean isGif, boolean isCircle,
                         boolean isMemoryCache, boolean isDiskCache){
        this.mPlaceImage=placeImage;
        this.mErrorImage=errorImage;
        this.mIsGif=isGif;
        this.mIsCircle=isCircle;
        this.mIsMemoryCache=isMemoryCache;
        this.mIsDiskCache=isDiskCache;
    }

   public static class Builder{

       /**
        * 占位图
        */
       private int placeImage;

       /**
        * 错误图
        */
       private int errorImage;

       /**
        * 是否支持Gif图
        */
       private boolean isGif;

       /**
        * 是否圆形图
        */
       private boolean isCircle;

       /**
        * 是否支持内存缓存
        */
       private boolean isMemoryCache;

       /**
        * 是否支持磁盘缓存
        */
       private boolean isDiskCache;

       public Builder setPlaceImage(int placeImage) {
           this.placeImage = placeImage;
           return this;
       }

       public Builder setErrorImage(int errorImage) {
           this.errorImage = errorImage;
           return this;
       }

       public Builder setGif(boolean gif) {
           isGif = gif;
           return this;
       }

       public Builder setCircle(boolean circle) {
           isCircle = circle;
           return this;
       }

       public Builder setMemoryCache(boolean memoryCache) {
           isMemoryCache = memoryCache;
           return this;
       }

       public Builder setDiskCache(boolean diskCache) {
           isDiskCache = diskCache;
           return this;
       }

       public ImageOptions build(){
           return new ImageOptions(placeImage, errorImage, isGif, isCircle,
           isMemoryCache, isDiskCache);
       }
   }
}
